<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  
    
      
    

    
  

  

  
    
      
    

    
  

  
    
      
    

    
  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Microsoft YaHei:300,300italic,400,400italic,700,700italic|Georgia:300,300italic,400,400italic,700,700italic|Lobster Two:300,300italic,400,400italic,700,700italic|consolas:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Openstack,Kolla,安装部署," />





  <link rel="alternate" href="/atom.xml" title="一本正经的小马" type="application/atom+xml" />




  <link rel="shortcut icon" type="image/x-icon" href="/images/favicon1.ico?v=5.1.0" />






<meta name="description" content="本部分主要介绍一些Kolla使用过程中总结的经验和技巧等零碎知识，不成体系，也会附带一部分Sahara Plugin在由Kolla部署OpenStack环境下，如何增加和生效。">
<meta name="keywords" content="Openstack,Kolla,安装部署">
<meta property="og:type" content="article">
<meta property="og:title" content="Kolla相关零零碎碎">
<meta property="og:url" content="https://www.hanbert.cn/2017/10/03/Kolla相关零零碎碎/index.html">
<meta property="og:site_name" content="一本正经的小马">
<meta property="og:description" content="本部分主要介绍一些Kolla使用过程中总结的经验和技巧等零碎知识，不成体系，也会附带一部分Sahara Plugin在由Kolla部署OpenStack环境下，如何增加和生效。">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2017-10-13T04:48:22.478Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Kolla相关零零碎碎">
<meta name="twitter:description" content="本部分主要介绍一些Kolla使用过程中总结的经验和技巧等零碎知识，不成体系，也会附带一部分Sahara Plugin在由Kolla部署OpenStack环境下，如何增加和生效。">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://www.hanbert.cn/2017/10/03/Kolla相关零零碎碎/"/>





  <title> Kolla相关零零碎碎 | 一本正经的小马 </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  







  <script type="text/javascript">
    (function() {
      var hm = document.createElement("script");
      hm.src = "//tajs.qq.com/stats?sId=61405345";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>








  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">一本正经的小马</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">假装不正经</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-essay">
          <a href="/categories/随笔" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-book"></i> <br />
            
            随笔
          </a>
        </li>
      
        
        <li class="menu-item menu-item-study">
          <a href="/categories/学习" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-paper-plane"></i> <br />
            
            学习
          </a>
        </li>
      
        
        <li class="menu-item menu-item-other">
          <a href="/categories/杂记" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-list"></i> <br />
            
            杂记
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocapitalize="off" autocomplete="off" autocorrect="off"
             placeholder="搜索..." spellcheck="false"
             type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="https://www.hanbert.cn/2017/10/03/Kolla相关零零碎碎/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="小马">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar1.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="一本正经的小马">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                Kolla相关零零碎碎
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-10-03T13:19:18+08:00">
                2017-10-03
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/学习/" itemprop="url" rel="index">
                    <span itemprop="name">学习</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a class="cloud-tie-join-count" href="/2017/10/03/Kolla相关零零碎碎/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count join-count" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          
             <span id="/2017/10/03/Kolla相关零零碎碎/" class="leancloud_visitors" data-flag-title="Kolla相关零零碎碎">
               <span class="post-meta-divider">|</span>
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>
               
                 <span class="post-meta-item-text">阅读次数 </span>
               
                 <span class="leancloud-visitors-count"></span>
             </span>
          

          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>本部分主要介绍一些Kolla使用过程中总结的经验和技巧等零碎知识，不成体系，也会附带一部分Sahara Plugin在由Kolla部署OpenStack环境下，如何增加和生效。</p>
<a id="more"></a>
<h4 id="节点规划"><a href="#节点规划" class="headerlink" title="节点规划"></a>节点规划</h4><p>节点的规划和容器的分布由<code>inventory</code>控制，<code>/usr/share/kolla/ansible/inventory</code>目录下的<code>all-in-one</code>和<code>multinode</code>,如果单节点部署，需要指定<code>all-in-one</code>；如果是多节点部署，你需要指定<code>multinode</code>。尽量不要动<code>all-in-one</code>，但是如果采用多节点安装，则<code>multinode</code>应该根据自己的实际情况改写。</p>
<h4 id="变量配置"><a href="#变量配置" class="headerlink" title="变量配置"></a>变量配置</h4><p>部署过程中用到的很多参数，大部分都写在<code>kolla-ansible/ansible/group_vars/all.yml</code>这个文件里面，有一部分写在<code>kolla-ansible/etc/kolla/globals.yml</code>中，两者有部分是重复的，<code>globals.yml</code>会覆盖<code>all.yml</code>的配置项。<br>这些变量的值，最终会替换<code>ansible</code>的<code>playbook</code>里面对应的变量的值，控制<code>playbook</code>的最终结果。这些<code>playbook</code>主要分为4类：</p>
<ul>
<li><strong>default</strong>：代表默认的一些配置</li>
<li><strong>meta</strong>：代表依赖于哪个playbook</li>
<li><strong>task</strong>：代表具体的部署任务</li>
<li><strong>template</strong>：代表模板，主要包含容器的配置文件，以及容器启动时的一些初始化操作，主要是拷贝配置文件和启动该容器对应的服务。</li>
</ul>
<p>这些配置<code>playbook</code>全部放在<code>kolla-ansible/ansible/roles</code>对应的目录下。</p>
<h4 id="部署前检测"><a href="#部署前检测" class="headerlink" title="部署前检测"></a>部署前检测</h4><p><code>kolla</code>提供了一个检测命令，可以对各个角色节点进行一些检测，主要是包括：</p>
<ul>
<li><strong>版本检测：</strong><code>docker-py</code>,<code>Ansible</code></li>
<li><strong>端口检测：</strong>所有容器配置的监听端口是否已经被占用</li>
<li><strong>服务检测：</strong>这里检测的就比较杂了，比如libvirt是否在运行，如果运行就会报错，比如Docker版本是否满足要求等等</li>
</ul>
<p>你可以查看<code>kolla-ansible/ansible/rolesprechecks/tasks</code>下面的playbook，知道所有的检测项。当检测出错时，你就需要根据出错的信息，对某些角色的节点进行些修改配置。 检测通过，下面的部署不一定成功，但检测没通过，下面的部署是肯定失败的。</p>
<h4 id="部署完成后的清理"><a href="#部署完成后的清理" class="headerlink" title="部署完成后的清理"></a>部署完成后的清理</h4><p>在某些情况下，可能需要对环境中的容器，镜像，甚至节点上的所有关于kolla的配置，进行清理，可以使用<code>kolla-ansible destroy -i inventory/multinode</code>的子命令对环境清理。</p>
<h4 id="部署完成后的扩展"><a href="#部署完成后的扩展" class="headerlink" title="部署完成后的扩展"></a>部署完成后的扩展</h4><p>kolla增加节点理论上很简单，只需要两步，一是修改对应的<code>inventory</code>，二是对待添加节点做好部署前的准备工作。</p>
<h4 id="修改某个容器的配置"><a href="#修改某个容器的配置" class="headerlink" title="修改某个容器的配置"></a>修改某个容器的配置</h4><p>通过修改对应节点<code>/etc/kolla/</code>目录下对应的服务的配置文件，然后重启对应的容器，就可以修改相关配置。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">docker restart CONTAINER1 CONTAINER2 CONTAINER3 ......</div></pre></td></tr></table></figure></p>
<p>如果是修改多个容器的配置，可以通过修改<code>kolla-ansible/ansible/roles</code>目录下对应的配置文件的模板，<code>/etc/kolla/globals.yml</code>下面的配置项，<code>kolla-ansible/ansible/group_vars/all.yml</code>里面的配置项，然后执行 <code>kolla-ansible reconfigure</code>命令即可。</p>
<blockquote>
<p><strong><em>Note:</em></strong><br>这种方式会将所有容器的配置重新覆盖一次，所有容器都会重启一次</p>
</blockquote>
<h4 id="修改代码"><a href="#修改代码" class="headerlink" title="修改代码"></a>修改代码</h4><p>使用<code>docker exec -it -u root CONTAINER_ID /bin/bash</code>命令以<code>root</code>用户的身份登录到相应的<code>container</code>中，然后直接修改里面的代码，如果需要修改配置文件，可以直接修改<code>/etc/kolla/</code>相应目录下的<code>.conf</code>文件，然后重启容器即可。</p>
<p>如果需要复用这个修改后的容器，可以使用<code>docker commit</code>基于你改动的容器，重新制作一个镜像，指定一个合适的<code>tag</code>(即容器镜像的版本，不要和已有镜像的重复)，最后上传到本地镜像仓库中即可。 </p>
<blockquote>
<p><strong><em>Note：</em></strong><br>当移除旧的容器，如果简单的执行<code>docker run</code>的相关命令启动一个新的容器会出错，原因是启动容器时会做些初始化的操作，由于涉及到文件的拷贝，所以会出现缺少相关文件的报错。而启动容器以及容器的初始化的操作由<code>kolla_toolbox</code>（这是kolla在部署过程中，第二个启动的容器）执行，具体的由<code>kolla_toolbox</code>里的<code>/usr/local/bin/kolla_start</code>和 <code>/usr/local/bin/kolla_set_configs</code>来控制。</p>
</blockquote>
<h4 id="基于Dockerfile重新制作的镜像："><a href="#基于Dockerfile重新制作的镜像：" class="headerlink" title="基于Dockerfile重新制作的镜像："></a>基于Dockerfile重新制作的镜像：</h4><p>由于采用源码的方式安装相关的第三方库，我们可以在<code>git</code>上维护相关的所有代码，在我们提交新的<code>commit</code>的时候，通过拉取新的源码，重新用<code>Dockerfile</code>制作镜像。一般来说<code>Dockerfile</code>都不需要变化。 </p>
<h4 id="部署完成后的环境的升级"><a href="#部署完成后的环境的升级" class="headerlink" title="部署完成后的环境的升级"></a>部署完成后的环境的升级</h4><p>可以通过修改<code>/etc/kolla/global.yml</code>里面<code>openstack-release</code>的参数，然后执行<code>kolla-ansible upgrade</code>的命令升级环境。理论上可以做到单个容器的升级，但是具体能不能实现，有待验证。</p>
<p>如果需要回滚就只是将<code>/etc/kolla/global.yml</code>里面<code>openstack-release</code>的参数，改回原来的版本即可。</p>
<h4 id="kolla网络相关参数"><a href="#kolla网络相关参数" class="headerlink" title="kolla网络相关参数"></a>kolla网络相关参数</h4><ul>
<li><strong>network_interface：</strong>为下面几种<code>interface</code>提供默认值</li>
<li><strong>api_interface: </strong>用于<code>management network</code>,即<code>openstack</code>内部服务间通信，以及服务于数据库通信的网络。这是系统的风险点，所以，这个网络推荐使用内网，不能够接出到外网，默认值为：<code>network_interface</code></li>
<li><strong>kolla_external_vip_interface: </strong>这是一个公网网段，当你想要<code>HAProxy Public endpoint</code>暴漏在不同的网络中的时候，需要用到。当<code>kolla_enables_tls_external</code>设置为<code>yes</code>的时候，是个必选项。默认值为：<code>network_interface</code></li>
<li><strong>storage_interface: </strong> 虚拟机与<code>Ceph</code>通信接口，这个接口负载较重，推荐放在<code>10Gig</code>网口上。默认值为：<code>network_interface</code></li>
<li><strong>cluster_interface: </strong>这是<code>Ceph</code>用到的另外一个接口，用于数据的<code>replication</code>，这个接口同样负载很重，当其成为bottleneck的时候，会影响数据的一致性和整个集群的性能。默认：<code>network_interface</code></li>
<li><strong>tunnel_interface: </strong>这个接口用于虚拟机与虚拟机之间的通信，通过 <code>tunneled</code>网路进行，比如：<code>Vxlan</code>，<code>GRE</code>等，默认为：<code>network_interface</code></li>
<li><strong>neutron_external_interface: </strong>这是<code>Neutron</code>需要的接口，<code>Neutron</code>会将其绑定在<code>br-ex</code>上，既可以是<code>flat</code>网络，也可以是<code>tagged vlan</code>网络，必须单独设置</li>
</ul>
<h4 id="Docker的一些配置建议"><a href="#Docker的一些配置建议" class="headerlink" title="Docker的一些配置建议"></a>Docker的一些配置建议</h4><p><code>Docker</code>是<code>kolla</code>的核心依赖，配置好<code>Docker</code>能够有效改变<code>kolla</code>的使用体验，在某些版本中<code>Docker</code>的存储驱动默认是<code>devicemapper</code>，这个<code>driver</code>严重损害性能。我们推荐使用<code>btrfs</code>或者<code>aufs</code>作为驱动。</p>
<p><code>kolla</code>将所有的永久数据存放在<code>Docker volumes</code>中，默认这个<code>volumes</code>在<code>docker</code>的工作目录下面创建，默认是：<code>/var/lib/docker</code>，建议确认这个目录具有足够的空间，否则会影响<code>Database</code>的<code>commits</code>和<code>rabbitmq</code>的性能<br>尤其当<code>enable_central_logging</code>和<code>openstack_logging_debug</code>设置为<code>true</code>的时候，更需要关注.</p>
<h4 id="部署完成后的服务运行日志"><a href="#部署完成后的服务运行日志" class="headerlink" title="部署完成后的服务运行日志"></a>部署完成后的服务运行日志</h4><p>所有组件的日志都放在<code>/var/lib/docker/volumes/kolla_logs/_data/</code>对应的目录下。</p>
<h4 id="替换Horizon的图标"><a href="#替换Horizon的图标" class="headerlink" title="替换Horizon的图标"></a>替换Horizon的图标</h4><p>提前将需要用到的文件凡在一台可以被<code>container</code> 通过<code>ssh</code>连接到的<code>host</code>的<code>/opt</code>目录下：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div></pre></td><td class="code"><pre><div class="line">//登陆Horizon的container中</div><div class="line">docker exec -it -u root horizon /bin/bash</div><div class="line"></div><div class="line">//替换下面这个目录下的对应文件</div><div class="line">cd /var/lib/kolla/venv/lib/python2.7/site-packages/openstack_dashboard/static/dashboard/img</div><div class="line">scp root@[SERVER_IP]:/opt/logo-splash.svg ./</div><div class="line">scp root@[SERVER_IP]:/opt/logo.svg ./</div><div class="line">scp root@[SERVER_IP]:/opt/favicon.ico ./</div><div class="line"></div><div class="line">//替换下面这个目录下的对应文件</div><div class="line">cd /var/lib/kolla/venv/lib/python2.7/site-packages/static/dashboard/img</div><div class="line">scp root@[SERVER_IP]:/opt/logo-splash.svg ./</div><div class="line">scp root@[SERVER_IP]:/opt/logo.svg ./</div><div class="line">scp root@[SERVER_IP]:/opt/favicon.ico ./</div><div class="line"></div><div class="line">//退出登陆</div><div class="line">exit</div></pre></td></tr></table></figure></p>
<p>以上过程做完后，无需重启容器，清空浏览器缓存，从新刷新<code>Dashboard</code>页面即可看到生效。</p>
<blockquote>
<p><strong><em>Note:</em></strong><br>如果存在多个<code>controller</code>节点，需要每个<code>controller</code>节点都做修改！！！</p>
</blockquote>
<h4 id="部署Sahara的Plugin代码"><a href="#部署Sahara的Plugin代码" class="headerlink" title="部署Sahara的Plugin代码"></a>部署Sahara的Plugin代码</h4><p>首先先将需要部署的<code>Plugin</code>代码放置到一台可以被<code>container</code> 通过<code>ssh</code>连接到的<code>host</code>的<code>/opt</code>目录下：</p>
<p>① 修改<code>Sahara_engine</code>服务容器<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div></pre></td><td class="code"><pre><div class="line">//登陆Sahara_engine容器</div><div class="line">docker exec -u root -it sahara_engine /bin/bash</div><div class="line"></div><div class="line">//拷贝Plugin代码</div><div class="line">cd /var/lib/kolla/venv/lib/python2.7/site-packages/sahara/plugins</div><div class="line">scp -r root@[SERVER_IP]:/opt/sandbox/ ./</div><div class="line"></div><div class="line">//修改 *.egg-info/entry_points.txt文件</div><div class="line">//在[sahara.cluster.plugins]选项下，添加“sandbox = sahara.plugins.sandbox.plugin:VanillaProvider”</div><div class="line">cd /var/lib/kolla/venv/lib/python2.7/site-packages/sahara-6.0.1-py2.7.egg-info</div><div class="line">vi entry_points.txt </div><div class="line"></div><div class="line">//退出容器</div><div class="line">exit</div><div class="line"></div><div class="line">//修改Sahara_engine的配置文件</div><div class="line">//在[DEFAULT]下，添加“plugins = sandbox,vanilla,spark,cdh,ambari,storm,mapr”</div><div class="line">docker restart sahara_engine</div><div class="line">cd /etc/kolla/sahara-engine</div><div class="line">vi sahara.conf</div><div class="line"></div><div class="line">//重启Sahara_engine容器</div><div class="line">docker restart sahara_engine</div></pre></td></tr></table></figure></p>
<p>② 修改<code>Sahara_api</code>服务容器<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div></pre></td><td class="code"><pre><div class="line">//登陆Sahara_api容器</div><div class="line">docker exec -u root -it sahara_api /bin/bash</div><div class="line"></div><div class="line">//拷贝Plugin代码</div><div class="line">cd /var/lib/kolla/venv/lib/python2.7/site-packages/sahara/plugins</div><div class="line">scp -r root@[SERVER_IP]:/opt/sandbox/ ./</div><div class="line"></div><div class="line">//修改 *.egg-info/entry_points.txt文件</div><div class="line">//在[sahara.cluster.plugins]选项下，添加“sandbox = sahara.plugins.sandbox.plugin:VanillaProvider”</div><div class="line">cd /var/lib/kolla/venv/lib/python2.7/site-packages/sahara-6.0.1-py2.7.egg-info</div><div class="line">vi entry_points.txt </div><div class="line"></div><div class="line">//退出容器</div><div class="line">exit</div><div class="line"></div><div class="line">//修改Sahara_api的配置文件</div><div class="line">//在[DEFAULT]下，添加“plugins = sandbox,vanilla,spark,cdh,ambari,storm,mapr”</div><div class="line">docker restart sahara_api</div><div class="line">cd /etc/kolla/sahara-api</div><div class="line">vi sahara.conf</div><div class="line"></div><div class="line">//重启Sahara_api容器</div><div class="line">docker restart sahara_api</div></pre></td></tr></table></figure></p>
<p>上述过程做完后，登陆<code>Dashboard</code>，找到<code>Data processing</code>下的<code>Plugin</code>,即可以看到已经生效。</p>
<blockquote>
<p><strong><em>Note:</em></strong><br>如果存在多个<code>controller</code>节点，需要每个<code>controller</code>节点都做修改！！！</p>
</blockquote>
<h4 id="通过Kolla工具进行Build镜像"><a href="#通过Kolla工具进行Build镜像" class="headerlink" title="通过Kolla工具进行Build镜像"></a>通过Kolla工具进行Build镜像</h4><p>此处的Kolla不同于上面的Kolla，上面的Kolla是指Kolla-ansible这个部署工具，这里的kolla 是个OpenStack的服务组件的Docker镜像构建工具，这点一定要分清。</p>
<p>① 安装kolla，源码安装<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">git clone http://git.trystack.cn/openstack/kolla</div><div class="line">cd kolla</div><div class="line">//切换到O版的分支</div><div class="line">git checkout origin/stable/ocata</div><div class="line">pip install ./</div><div class="line">pip show kolla //查看kolla的版本</div></pre></td></tr></table></figure></p>
<p>② 开始build镜像<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">kolla-build –b centos –t binary –p default</div></pre></td></tr></table></figure></p>
<p>相关参数说明：</p>
<ul>
<li><strong>-b：</strong>指定build的镜像系统类型，<code>centos</code>或者<code>ubuntu</code></li>
<li><strong>-t：</strong>制定安装类型，<code>binary</code>为二进制安装,<code>source</code>为源码安装</li>
<li><strong>-p：</strong>指定build哪些镜像，默认：<code>chrony</code>,<code>cron</code>,<code>kolla-toolbox</code>,<code>glance</code>,<code>haproxy</code>,<code>heat</code>,<code>heka</code>,<code>horizon</code>,<code>keepalived</code>,<code>keystone</code>,<code>mariadb</code>,<code>memcached</code>,<code>neutron</code>,<code>nova</code>,<code>openvswitch</code>,<code>rabbitmq</code>；如果不指定<code>-p</code>可以单独指定build某个，如：<code>nova</code></li>
</ul>
<blockquote>
<p><strong><em>Note:</em></strong><br>这个过程可能会因为网络问题导致build失败，可以重复几次。</p>
</blockquote>
<p>③ build完成后查看本地镜像，并打包保存：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">// 查看本地镜像</div><div class="line">docker images</div><div class="line"></div><div class="line">//镜像打包保存</div><div class="line">docker save lokolla/centos-binary-haproxy &gt;/opt/centos-binary-haproxy.tar</div></pre></td></tr></table></figure></p>
<p>④ 在目标机器上启动一个<code>Registry</code>服务：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">docker run -d -p 4000:5000 --restart=always --name registry registry:2</div></pre></td></tr></table></figure></p>
<p>⑤ 将打包好的本地镜像，先拷贝到目标机器上，<code>load</code>一下推送到<code>registry</code>中去：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">//导入到目标机器上</div><div class="line">docker load &lt; /opt/centos-binary-haproxy.tar</div><div class="line">//给单独的一个镜像打标签，以haproxy为例</div><div class="line">docker tag  7f5595d85f41 [SERVER_IP]:4000/test/centos-binary-haproxy:4.0.3</div><div class="line">//推送到本地registry中</div><div class="line">docker push [SERVER_IP]:4000/test/centos-binary-haproxy</div></pre></td></tr></table></figure></p>
<blockquote>
<p><strong><em>Reference:</em></strong></p>
<ul>
<li>OpenStack实战分享：Kolla多节点部署加Ceph后端: <a href="http://www.99cloud.net/html/2017/jiuzhouyuanchuang_0317/302.html" target="_blank" rel="external">http://www.99cloud.net/html/2017/jiuzhouyuanchuang_0317/302.html</a></li>
</ul>
</blockquote>
<h4 id="Docker更换国内镜像下载源"><a href="#Docker更换国内镜像下载源" class="headerlink" title="Docker更换国内镜像下载源"></a>Docker更换国内镜像下载源</h4><p>由于国内特殊的网络环境，往往我们从Docker Hub中拉取镜像并不能成功，而且速度特别慢。那么我们可以给Docker配置一个国内的registry mirror，当我们需要的镜像在mirror中则直接返回，如果没有则从Docker Hub中拉取。是否使用registry mirror对Docker用户来说是透明的。</p>
<p>DaoCloud在国内提供了首个Docker Hub镜像服务，而且免费，大大提高了国内Docker用户的使用热情，非常感谢DaoCloud。</p>
<p><strong>使用方法：</strong></p>
<p>① 修改Docker配置文件<code>/etc/default/docker</code>，添加如下内容：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">DOCKER_OPTS=&quot;--registry-mirror=http://aad0405c.m.daocloud.io&quot;</div></pre></td></tr></table></figure>
<p>② 重启Docker服务：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">service docker restart</div></pre></td></tr></table></figure>
<p>现在就可以直接从国内源pull镜像啦！</p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        
  <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
    <div></div>
    <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
      <span>赏</span>
    </button>
    <div id="QR" style="display: none;">
      
        <div id="wechat" style="display: inline-block">
          <img id="wechat_qr" src="/images/jok.png" alt="小马 WeChat Pay"/>
          <p>微信打赏</p>
        </div>
      
      
    </div>
  </div>


      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Openstack/" rel="tag"># Openstack</a>
          
            <a href="/tags/Kolla/" rel="tag"># Kolla</a>
          
            <a href="/tags/安装部署/" rel="tag"># 安装部署</a>
          
        </div>
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/10/03/Kolla多节点物理机部署OpenStack/" rel="next" title="Kolla多节点物理机部署OpenStack">
                <i class="fa fa-chevron-left"></i> Kolla多节点物理机部署OpenStack
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div id="cloud-tie-wrapper" class="cloud-tie-wrapper"></div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/avatar1.jpg"
               alt="小马" />
          <p class="site-author-name" itemprop="name">小马</p>
           
              <p class="site-description motion-element" itemprop="description">假装不正经</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/">
                <span class="site-state-item-count">11</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">2</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">21</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        
          <div class="feed-link motion-element">
            <a href="/atom.xml" rel="alternate">
              <i class="fa fa-rss"></i>
              RSS
            </a>
          </div>
        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/hanbert" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://weibo.com/BertHan" target="_blank" title="微博">
                  
                    <i class="fa fa-fw fa-globe"></i>
                  
                  微博
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-4"><a class="nav-link" href="#节点规划"><span class="nav-number">1.</span> <span class="nav-text">节点规划</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#变量配置"><span class="nav-number">2.</span> <span class="nav-text">变量配置</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#部署前检测"><span class="nav-number">3.</span> <span class="nav-text">部署前检测</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#部署完成后的清理"><span class="nav-number">4.</span> <span class="nav-text">部署完成后的清理</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#部署完成后的扩展"><span class="nav-number">5.</span> <span class="nav-text">部署完成后的扩展</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#修改某个容器的配置"><span class="nav-number">6.</span> <span class="nav-text">修改某个容器的配置</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#修改代码"><span class="nav-number">7.</span> <span class="nav-text">修改代码</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#基于Dockerfile重新制作的镜像："><span class="nav-number">8.</span> <span class="nav-text">基于Dockerfile重新制作的镜像：</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#部署完成后的环境的升级"><span class="nav-number">9.</span> <span class="nav-text">部署完成后的环境的升级</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#kolla网络相关参数"><span class="nav-number">10.</span> <span class="nav-text">kolla网络相关参数</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#Docker的一些配置建议"><span class="nav-number">11.</span> <span class="nav-text">Docker的一些配置建议</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#部署完成后的服务运行日志"><span class="nav-number">12.</span> <span class="nav-text">部署完成后的服务运行日志</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#替换Horizon的图标"><span class="nav-number">13.</span> <span class="nav-text">替换Horizon的图标</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#部署Sahara的Plugin代码"><span class="nav-number">14.</span> <span class="nav-text">部署Sahara的Plugin代码</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#通过Kolla工具进行Build镜像"><span class="nav-number">15.</span> <span class="nav-text">通过Kolla工具进行Build镜像</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#Docker更换国内镜像下载源"><span class="nav-number">16.</span> <span class="nav-text">Docker更换国内镜像下载源</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy;  2016 - 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">小马</span>
</div>


<div class="powered-by">
   <a class="theme-link" href="https://www.hanbert.cn"> </a> 小马专属
</div>

<div class="theme-info">
  博客 -
  <a class="theme-link" href="https://www.hanbert.cn">
    记录我的生活
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  







  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  


  




	





  
    
    <script>
      var cloudTieConfig = {
        url: document.location.href, 
        sourceId: "",
        productKey: "a112af18c95445c591096a909c4fb62c",
        target: "cloud-tie-wrapper"
      };
    </script>
    <script src="https://img1.ws.126.net/f2e/tie/yun/sdk/loader.js"></script>
  










  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length == 0) {
      search_path = "search.xml";
    }
    var path = "/" + search_path;
    // monitor main search box;

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.popup').toggle();
    }
    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';
      $.ajax({
        url: path,
        dataType: "xml",
        async: true,
        success: function( xmlResponse ) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = $( "entry", xmlResponse ).map(function() {
            return {
              title: $( "title", this ).text(),
              content: $("content",this).text(),
              url: $( "url" , this).text()
            };
          }).get();
          var $input = document.getElementById(search_id);
          var $resultContent = document.getElementById(content_id);
          $input.addEventListener('input', function(){
            var matchcounts = 0;
            var str='<ul class=\"search-result-list\">';
            var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
            $resultContent.innerHTML = "";
            if (this.value.trim().length > 1) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var content_index = [];
                var data_title = data.title.trim().toLowerCase();
                var data_content = data.content.trim().replace(/<[^>]+>/g,"").toLowerCase();
                var data_url = decodeURIComponent(data.url);
                var index_title = -1;
                var index_content = -1;
                var first_occur = -1;
                // only match artiles with not empty titles and contents
                if(data_title != '') {
                  keywords.forEach(function(keyword, i) {
                    index_title = data_title.indexOf(keyword);
                    index_content = data_content.indexOf(keyword);
                    if( index_title >= 0 || index_content >= 0 ){
                      isMatch = true;
                      if (i == 0) {
                        first_occur = index_content;
                      }
                    }

                  });
                }
                // show search results
                if (isMatch) {
                  matchcounts += 1;
                  str += "<li><a href='"+ data_url +"' class='search-result-title'>"+ data_title +"</a>";
                  var content = data.content.trim().replace(/<[^>]+>/g,"");
                  if (first_occur >= 0) {
                    // cut out 100 characters
                    var start = first_occur - 20;
                    var end = first_occur + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if(start == 0){
                      end = 50;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    var match_content = content.substring(start, end);
                    // highlight all keywords
                    keywords.forEach(function(keyword){
                      var regS = new RegExp(keyword, "gi");
                      match_content = match_content.replace(regS, "<b class=\"search-keyword\">"+keyword+"</b>");
                    });

                    str += "<p class=\"search-result\">" + match_content +"...</p>"
                  }
                  str += "</li>";
                }
              })};
            str += "</ul>";
            if (matchcounts == 0) { str = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>' }
            if (keywords == "") { str = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>' }
            $resultContent.innerHTML = str;
          });
          proceedsearch();
        }
      });}

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched == false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(function(e){
      $('.popup').hide();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    });
    $('.popup').click(function(e){
      e.stopPropagation();
    });
  </script>





  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script>
  <script>AV.initialize("PON7x61Hu1UYOgywYUN55ig8-gzGzoHsz", "1bzugjkBEuXCThr7Cro7lz6l");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  

  
  
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
  


  

  
  <!-- 背景动画 -->
  <div id="particles-js"></div>
  <script type="text/javascript" src="/js/src/particle.js"></script>
  <!-- <script src="js/app.js"></script> -->
  
</body>
</html>
